const mongoose = require('mongoose')
const Schema = mongoose.Schema;
const { BaseParameter } = require('../base/model')

const bannerSchema = new Schema({
  ...BaseParameter,
  /**
   * 图片链接
   */
  "pic": {type: String, default: ''},
  /**
   * 标题
   */
  "title": {type: String, default: ''},
  /**
   * 详情说明
   */
  "detail": {type: String, default: ''},
  /**
   * 跳转链接
   */
  "switch": {type: String, default: ''},
  /**
   * 索引，用来排序
   */
  "index": {type: Number, default: 0},
  /**
   * ID
   */
  "id": {
    type: String,
    get: function () {
      return String(this._id)
    }
  }
});

const Banner = mongoose.model('Banner', bannerSchema, 'banners');

module.exports = Banner
